﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;

namespace BHTT.Khohang
{
    public partial class Kho : System.Web.UI.Page, ICallbackEventHandler
    {
        public string EditKho;
        protected void Page_Load(object sender, EventArgs e)
        {
            EditKho = Page.ClientScript.GetCallbackEventReference(this, "args", "callBackDangnhap", "context", null, true);
        }

        #region ICallbackEventHandler members
        public void RaiseCallbackEvent(string eventAgurment)
        {
            EditKho = eventAgurment;
        }


        public string GetCallbackResult()
        {
            String s = EditKho;
            return EditKho;
        }
        #endregion

        protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
        {
           
        }
        protected void RadioButtonList2_SelectedIndexChanged(object sender, EventArgs e)
        {
           
        }

        protected void RadGrid_ItemCreated(object sender, GridItemEventArgs e)
        {
            
        }

        protected void RadGrid_ItemUpdated(object source, Telerik.Web.UI.GridUpdatedEventArgs e)
        {
            if (e.Exception != null)
            {
                e.KeepInEditMode = true;
                e.ExceptionHandled = true;
                DisplayMessage(true, "Customer " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["CustomerID"] + " cannot be updated due to invalid data.");
            }
            else
            {
                DisplayMessage(false, "Customer " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["CustomerID"] + " updated");
            }
        }

        protected void RadGrid_ItemInserted(object source, GridInsertedEventArgs e)
        {
            if (e.Exception != null)
            {
                e.ExceptionHandled = true;
                e.KeepInInsertMode = true;
                DisplayMessage(true, "Customer cannot be inserted due to invalid data.");
            }
            else
            {
                DisplayMessage(false, "Customer inserted");
            }
        }

        protected void RadGrid_ItemDeleted(object source, GridDeletedEventArgs e)
        {
            if (e.Exception != null)
            {
                e.ExceptionHandled = true;
                DisplayMessage(true, "Customer " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["CustomerID"] + " cannot be deleted");
            }
            else
            {
                DisplayMessage(false, "Customer " + e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["CustomerID"] + " deleted");
            }
        }

        private void DisplayMessage(bool isError, string text)
        {
           
        }
    }
}